#include <iostream>
#define TASKNUMS 3
typedef void (*task_t)(); // task_t 函数指针类型

void Print()
{
    std::cout << "I am print task" << std::endl;
}
void DownLoad()
{
    std::cout << "I am a download task" << std::endl;
}
void Flush()
{
    std::cout << "I am a flush task" << std::endl;
}

task_t tasks[TASKNUMS];

void LoadTask()
{
    tasks[0] = Print;
    tasks[1] = DownLoad;
    tasks[2] = Flush;
}

void ExcuteTask(const int& taskid)
{
    std::cout << "excute task : " << taskid << std::endl;
    tasks[taskid]();
}

int main()
{
    LoadTask();
    ExcuteTask(0);
    ExcuteTask(1);
    ExcuteTask(2);
    return 0;
}